﻿function IsNumber(number) {
    if ((number >= 0) || (number < 0)) return true;
    else return false;
}

function getNewName(name) {
    var letters = new Array(name.length);
    var weird = "";
    for (i = 1; i <= name.length; i++)
        letters[i] = name.substring(i, i - 1);
    for (i = 1; i <= letters.length - 3; i++)
        weird += letters[i] + letters[i + 2]
    return weird;
}

function IsNegative(number) {
    return number < 0 ? true : false;
}

function reverse(name) {
    var length = name.length;
    var letters = new Array(length);
    var letters2 = new Array(length);
    var backword = "";
    for (i = 0; i <= length - 1; i++) {
        letters[i] = name.substring(i, i + 1);
    }
    f = 0
    for (j = i - 1; j >= 0; j--) {
        letters2[f] = letters[j];
        f++;
    }
    for (h = 0; h <= letters2.length - 1; h++) {
        backword += letters2[h];
    }
    return backword;
}

function encrypt(name) {
    var alpha = new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");

    var crypt = new Array("4", "B", "C", "D", "3", "F", "G", "H", "1", "J", "K", "L", "M", "N", "0", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z");

    var newword = " ";

    for (i = 0; i <= name.length; i++) {
        var char = name.substring(i, i + 1);
        for (j = 0; j <= alpha.length; j++) {
            if (char == alpha[j]) newword += crypt[j];
        }
    }
    return newword;
}

function getchar(string, char_pos) {
    return string.substring(char_pos, char_pos + 1);
}
